package com.huangfu.easysardine.ui.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Base64Utils;

import javax.servlet.http.HttpServletRequest;

/**
 * Created with IntelliJ IDEA.
 * User: huangfu.daohui
 * Date: 2017-8-14
 * Time: 13:37
 * Description:控制基类
 */
public class BaseController {
    @Autowired
    private HttpServletRequest request;

    public String getCurrentUserName() {
        //获取头部校验信息，在zuul中add的
        String authorization = request.getHeader("Authorization");
        return new String(Base64Utils.decodeFromString(authorization));
    }
}
